'use strict';

const Controller = require('egg').Controller;

class StatisticsController extends Controller {
  async overview() {
    const { ctx } = this;
    try {
      const data = await ctx.service.statistics.getOverview();
      ctx.body = { 
        code: 200, 
        message: '获取统计数据成功', 
        data 
      };
    } catch (error) {
      ctx.logger.error('获取统计数据失败:', error);
      ctx.body = { 
        code: 500, 
        message: error.message || '统计获取失败', 
        data: null 
      };
    }
  }
}

module.exports = StatisticsController;


